<template>
  <div class="about">
    <h1>This is an about page</h1>
  </div>
</template>

<script>
import axios from 'axios'
import vue from 'vue';
export default {
  created(){
    const CancelToken = axios.CancelToken;
    vue.cancels = []
    axios({
      method:"get",
      url:'https://cnodejs.org/api/v1/topics',
      cancelToken: new CancelToken(c => {
        vue.cancels.push(c)
      })
    }).then(res=>{
      console.log(res);
    }).catch(res=>{
      return {message:'中断成功'}
    })

    axios({
      method:"get",
      url:'https://cnodejs.org/api/v1/topics',
      cancelToken: new CancelToken(c => {
        vue.cancels.push(c)
      })
    }).then(res=>{
      console.log(res);
    }).catch(res=>{
      return {message:'中断成功2'}
    })
    // cancel()
    // vue.cancels.map(v=>{
    //   v()
    // })
  }
}
</script>
